using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraAdapter : MonoBehaviour
{
    Camera m_camera;

    [SerializeField]
    float m_screenHeight = 1920f;

    [SerializeField]
    float m_screenWidth = 1080f;

    private void Awake()
    {
        m_camera = gameObject.GetComponent<Camera>();

        //Screen.width
        //Screen.height
    }

    // Start is called before the first frame update
    void Start()
    {
        float aspect = m_camera.aspect;
        float designOrthographicSize = 9.6f;
        float designAspect = m_screenWidth / m_screenHeight;
        float widthOrthographicSize = designOrthographicSize * designAspect;
        switch (Screen.orientation)
        {
            case ScreenOrientation.Portrait:
                if (aspect < designAspect)
                {
                    m_camera.orthographicSize = widthOrthographicSize / aspect;
                }
                if (aspect > designAspect)
                {
                    m_camera.orthographicSize = designOrthographicSize;
                    //_camera.orthographicSize = designOrthographicSize * (aspect / designAspect);
                }
                break;
            case ScreenOrientation.AutoRotation:
                break;
            case ScreenOrientation.LandscapeLeft:
                break;
            case ScreenOrientation.LandscapeRight:
                break;
            case ScreenOrientation.PortraitUpsideDown:
                break;
            default:
                break;

        }
        //m_camera.fieldOfView = 
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
